ifndef CROSS_COMPILE
CROSS_COMPILE = or32-uclinux-
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
NM = $(CROSS_COMPILE)nm

endif

export	CROSS_COMPILE

all: reset.bin reset.elf System.map

reset.o: reset.S
	$(CC) -c -o $@ $< $(CFLAGS)

reset.elf: reset.o
	$(LD) -Tram.ld -o $@ reset.o

reset.bin: reset.o
	$(LD) -Tram.ld -o $@ reset.o -b binary

System.map: reset.elf
	@$(NM) $< | \
		grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
		sort > System.map

clean:
	rm -f *.o *.bin *.elf *.map
